package com.cqan.account.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.cqan.account.entity.Permission;
import com.cqan.account.service.PermissionService;
import com.cqan.common.ViewName;
import com.cqan.controller.BaseController;
import com.cqan.exception.AppException;

@Controller
@RequestMapping("/permission")
public class PermissionController extends BaseController<Permission,Long, PermissionService> {

	@RequestMapping(value="/add",method=RequestMethod.GET)
	public ModelAndView add(HttpServletRequest req, HttpServletResponse resp) throws AppException {
		Permission permission1 = new Permission();
		permission1.setEnabled(true);
		permission1.setName("信息管理");
		
		entityService.add(permission1);
		return new ModelAndView(ViewName.MAIN_HOME);
	}

	
	@RequestMapping(value="/index",method=RequestMethod.GET)
	public ModelAndView list(HttpServletRequest req, HttpServletResponse resp) throws AppException {
		ModelAndView view = new ModelAndView(ViewName.PERMISSION_INDEX);
		
		return view;
	}

	public ModelAndView delete(HttpServletRequest req, HttpServletResponse resp) throws AppException {
		
		return null;
	}

	public ModelAndView update(HttpServletRequest req, HttpServletResponse resp) throws AppException {
		
		return null;
	}

	@Autowired
	public void setEntityService(PermissionService entityService) {
		this.entityService = entityService;
	}

}
